package com.lmxdawn.api.common.session;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 会话策略接口类
 *
 * @author jy
 * @since 2023-12-04 13:35
 */
public interface SessionStrategy {
    
    /**
     * 会话登录
     * @param userSession
     * @param request
     * @param response
     */
    void login(UserSession userSession, HttpServletRequest request, HttpServletResponse response);
    
    /**
     * 会话退出
     * @param request
     * @param response
     */
    void logout(HttpServletRequest request, HttpServletResponse response);
    
    /**
     * 获取用户会话
     * @param request
     * @return
     */
    UserSession getUserSession(HttpServletRequest request);

    /**
     * 获取用户会话
     * @param token
     * @return
     */
    UserSession getUserSession(String token);
    
    /**
     * 踢人下线，根据账号id
     *
     * @param loginId 账号id
     */
    void kickout(Object loginId);

}
